/**
* @file The following functions wrap c stubs
*
* 1. output to stdout
*
* @author gdhuang@ntu.edu.tw
*/

#ifndef _CIL_WRAP_H
#define _CIL_WRAP_H

#include <caml/mlvalues.h>
#include <caml/memory.h>
#include <caml/alloc.h>
#include <caml/callback.h>
#include "ocaml_type.h"
#include "cil_type.h"
#include "cil_stub.h"





/**
* Ocaml
*/
OCamlOutChannel OCaml_stdout_wrap();

OCamlOutChannel OCaml_open_out_wrap(char* filename);

void OCaml_flush_wrap();


/**
* module Pretty
*/
PrettyDoc Pretty_nil_wrap();

void Pretty_fprint_wrap(PrettyDoc doc);

/**
* module Cil
*/
extern CilFile Frontc_parse_wrap(const char* filename);
CilPrinter Cil_defaultCilPrinter_wrap();

void Cil_dumpFile_wrap(CilFile file);
void Cil_dumpGlobal_wrap(CilGlobal global);
void Cil_dumpInit_wrap(CilInit init);
void Cil_dumpBlock_wrap(CilBlock block);
void Cil_dumpStmt_wrap(CilStmt stmt);

void Cil_d_type_wrap(CilTyp typ);
void Cil_d_exp_wrap(CilExp exp);
void Cil_d_lval_wrap(CilLval lval);
void Cil_d_offset_wrap(CilOffset offset);
void Cil_d_init_wrap(CilInit init);
void Cil_d_binop_wrap(CilBinop binop);
void Cil_d_unop_wrap(CilUnop unop);
void Cil_d_attr_wrap(CilAttribute attr);
void Cil_d_attrparam_wrap(CilAttrparam attrparam);
void Cil_d_attrlist_wrap(OCamlList attrlist);
void Cil_d_instr_wrap(CilInstr instr);
void Cil_d_label_wrap(CilLabel label);
void Cil_d_stmt_wrap(CilStmt stmt);
void Cil_d_block_wrap(CilBlock block);
void Cil_d_global_wrap(CilGlobal global);
void Cil_d_shortglobal_wrap(CilGlobal global);

void Cil_dn_type_wrap(CilTyp typ);
void Cil_dn_exp_wrap(CilExp exp);
void Cil_dn_lval_wrap(CilLval lval);
void Cil_dn_init_wrap(CilInit init);
void Cil_dn_attr_wrap(CilAttribute attr);
void Cil_dn_attrparam_wrap(CilAttrparam attrparam);
void Cil_dn_attrlist_wrap(OCamlList attrlist);
void Cil_dn_instr_wrap(CilInstr instr);
void Cil_dn_stmt_wrap(CilStmt stmt);
void Cil_dn_global_wrap(CilGlobal global);


/**
* module Cfg
*/
void Cfg_printCfgChannel_wrap(CilFundec fundec);
int Cfg_start_id_wrap();
OCamlList Cfg_nodeList_wrap();
int Cfg_numNodes_wrap();


#endif
